1. Field of the Invention
The present invention relates to a disk drive such as a hard disk drive (HDD) and a control method thereof, and more particularly, to a disk drive with a cache memory and a method for controlling the same.
2. Description of Related Art
Hard disk drives (HDD) are often used as an auxiliary storage for an information processing unit. Conventional HDDs often include a cache memory for temporarily storing the data supplied from the information processing unit (hereinafter referred to as host) or temporarily storing the data read from a magnetic disk until this data is transferred to the host, and a controller for performing the cache control.
When the controller receives data from the host, the controller temporarily stores the write data in the cache memory, and then releases the host from processing the write data. Concurrently, the controller controls further processing of the write data so that the write data retained in the cache memory is sequentially written into the magnetic disk (hereinafter referred to as medium). Furthermore, the controller performs the reading of data from the medium for which a read request is expected from the host, and temporarily stores that read data in the cache memory. Once a read request is issued from the host and the data to be read is retained in the cache memory, it is transferred to the host. Such cache control often increases the access speed of the HDD.
Recently, many low end HDDs attempt to increase the performance of the HDD by decreasing the command overhead. The command overhead is often decreased by reducing the intervention of the microprocessor of the HDD (hereinafter referred to as local MPU) while performing data processing around the host interface. Rather than having the local MPU perform such processing, a host interface controller (HIC) performs the data processing around the interface by hardware.
For many HDDs, the transfer of data between the host and the cache memory is controlled by the HIC without any intervention from the local MPU, while the transfer of data between the medium and the cache memory requires the intervention of the local MPU. If all the data required by a read command from the host is already retained in the cache memory (i.e., an "all-hit" situation), then all of the data can be transferred without the intervention of the local MPU. The following two techniques are often used in conventional HDDS.
(1) While the intervention of the local MPU is not required, performing all of the processing by hardware.
(2) No data transfer is performed by hardware such that the local MPU always intervenes.
Although these two techniques reduce the intervention from the local MPU as much as possible by increasing the processing by the HIC as much as possible, there is a limit to the increase in performance of the HDD.
For example, for the first technique, although the corresponding command itself can be processed at a very high speed because the processing is performed by hardware, the performance may be decreased in the following situation.
Supposed that the above described "all-hit" situation continues at very short command intervals. This case corresponds to a sequential read which may occur frequently. In this case, data can be transferred at high speed as long as all the requested data is stored in the cache memory. Because this technique does not allow any intervention from the local MPU, no additional data can be transferred from the medium to the cache memory. Accordingly, the data in the cache memory is exhausted after a while, and the required data must be read from the medium. This requires an extremely long time as compared with the command overhead time needed for data transfer, such as the turning of the medium, and thus the data transfer speed largely decreases.
On the other hand, if the second technique is used, the disadvantage described above can be avoided because the local MPU is allowed to intervene. However, the advantages provided by the hardware cannot be exploited.